/*      */ package dm.jdbc.driver;
/*      */ 
/*      */ import dm.jdbc.dbaccess.Const;
/*      */ import dm.jdbc.dbaccess.DBError;
/*      */ import dm.jdbc.desc.ParameterDesc;
/*      */ import dm.jdbc.innerData.DmdbConnAgent;
/*      */ import dm.jdbc.innerData.DmdbParamVal;
/*      */ import dm.jdbc.rsCache.DmdbCachedResultSetPool;
/*      */ import dm.jdbc.rsCache.DmdbResultSetKey;
/*      */ import dm.sql.ARRAY;
/*      */ import dm.sql.DmdbIntervalDT;
/*      */ import dm.sql.DmdbIntervalYM;
/*      */ import dm.sql.DmdbSQLOutput;
/*      */ import dm.sql.DmdbTime;
/*      */ import dm.sql.STRUCT;
/*      */ import dm.sql.StructDescriptor;
/*      */ import java.io.InputStream;
/*      */ import java.io.Reader;
/*      */ import java.math.BigDecimal;
/*      */ import java.math.BigInteger;
/*      */ import java.net.URL;
/*      */ import java.sql.Array;
/*      */ import java.sql.BatchUpdateException;
/*      */ import java.sql.Blob;
/*      */ import java.sql.Clob;
/*      */ import java.sql.ParameterMetaData;
/*      */ import java.sql.PreparedStatement;
/*      */ import java.sql.Ref;
/*      */ import java.sql.ResultSet;
/*      */ import java.sql.ResultSetMetaData;
/*      */ import java.sql.SQLData;
/*      */ import java.sql.SQLException;
/*      */ import java.sql.Struct;
/*      */ import java.sql.Time;
/*      */ import java.sql.Timestamp;
/*      */ import java.util.ArrayList;
/*      */ import java.util.Calendar;
/*      */ import java.util.Map;
/*      */ import java.util.ResourceBundle;
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ public class DmdbPreparedStatement_bs
/*      */   extends DmdbStatement_bs
/*      */   implements PreparedStatement
/*      */ {
/*  102 */   ParameterDesc[] m_paramsDesc = null;
/*      */   
/*  104 */   private int m_outParamCount = 0;
/*      */   
/*  106 */   String printMsg = null;
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*  111 */   boolean realClose = false;
/*      */   
/*      */   public void setRealClose(boolean rClose)
/*      */   {
/*  115 */     this.realClose = rClose;
/*      */   }
/*      */   
/*  118 */   private final ResourceBundle res = Const.res;
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*  123 */   Object[] m_paramObjects = null;
/*      */   
/*  125 */   byte[][] m_nullIndicator = null;
/*      */   
/*      */ 
/*  128 */   private int m_rowIndex = -1;
/*      */   
/*  130 */   protected DmBinder[] m_curRow = null;
/*      */   
/*      */   private int m_rowsAllocated;
/*      */   
/*  134 */   private byte[] m_bindIndicator = null;
/*      */   
/*  136 */   private boolean m_isBatchOpt = false;
/*      */   
/*  138 */   private boolean m_bp_with_err = false;
/*      */   
/*      */   private void checkIndexInner(int index) throws SQLException
/*      */   {
/*  142 */     int paramCount = getParamCount();
/*  143 */     if ((index < 1) || (index > paramCount))
/*      */     {
/*  145 */       String str = "colid = " + index + ",  ";
/*  146 */       if (this.m_paramsDesc == null) {
/*  147 */         str = str + "m_paramsDesc is null";
/*      */       } else {
/*  149 */         str = str + "m_paramsDesc length is " + paramCount;
/*      */       }
/*  151 */       if (Const.TRACE_LEVEL > 0)
/*      */       {
/*  153 */         DmdbLog.trace(this, "checkIndex()", str);
/*      */       }
/*  155 */       DBError.throwSQLException(6010);
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */   protected synchronized void paramBindPrepare(int paramIndex)
/*      */     throws SQLException
/*      */   {
/*  163 */     checkIndexInner(paramIndex);
/*      */     
/*  165 */     if (this.m_rowIndex < 0) {
/*  166 */       this.m_rowIndex = 0;
/*      */     }
/*  168 */     int i = paramIndex - 1;
/*      */     
/*  170 */     if ((!this.m_isBatchOpt) && ((this.m_bindIndicator[i] & 0x1) == 1))
/*      */     {
/*  172 */       if (this.m_curRow[i] != null)
/*      */       {
/*  174 */         if ((this.m_curRow[i] instanceof DmOutParamBinder))
/*      */         {
/*  176 */           this.m_curRow[i].setInoutParamBinder(null);
/*  177 */           if (this.m_paramsDesc[i].getIOType() == 2) {
/*  178 */             this.m_curRow[i].setInoutParamBinder(new DmNullBinder(this));
/*      */           }
/*      */         }
/*      */         else {
/*  182 */           this.m_curRow[i] = new DmNullBinder(this);
/*      */         }
/*      */       }
/*      */       
/*  186 */       this.m_paramObjects[i] = null;
/*      */     }
/*      */     
/*  189 */     this.m_nullIndicator[this.m_rowIndex][i] = 0; int 
/*  190 */       tmp142_141 = i; byte[] tmp142_138 = this.m_bindIndicator;tmp142_138[tmp142_141] = ((byte)(tmp142_138[tmp142_141] | 0x1));
/*      */   }
/*      */   
/*      */   protected synchronized void OutparamBindPrepare(int paramIndex) throws SQLException
/*      */   {
/*  195 */     checkIndexInner(paramIndex);
/*      */     
/*  197 */     if (this.m_rowIndex < 0) {
/*  198 */       this.m_rowIndex = 0;
/*      */     }
/*  200 */     int i = paramIndex - 1;
/*      */     
/*  202 */     if ((!this.m_isBatchOpt) && ((this.m_bindIndicator[i] & 0x80) == 128))
/*      */     {
/*  204 */       if (this.m_curRow[i] != null)
/*      */       {
/*  206 */         if ((this.m_curRow[i] instanceof DmOutParamBinder))
/*      */         {
/*  208 */           DmBinder inbinder = ((DmOutParamBinder)this.m_curRow[i]).getInoutParamBinder();
/*  209 */           this.m_curRow[i] = new DmOutParamBinder(this);
/*  210 */           this.m_curRow[i].setInoutParamBinder(inbinder);
/*      */         }
/*      */       }
/*      */     }
/*      */     
/*      */ 
/*      */ 
/*  217 */     int tmp107_106 = i; byte[] tmp107_103 = this.m_bindIndicator;tmp107_103[tmp107_106] = ((byte)(tmp107_103[tmp107_106] | 0x80));
/*      */   }
/*      */   
/*      */   private void growBinds(int totalRows)
/*      */   {
/*  222 */     if (totalRows < this.m_rowsAllocated) {
/*  223 */       return;
/*      */     }
/*  225 */     int destRows = 0;
/*  226 */     if (this.m_rowsAllocated > 20000) {
/*  227 */       destRows = this.m_rowsAllocated + 20000;
/*      */     } else {
/*  229 */       destRows = this.m_rowsAllocated * 2;
/*      */     }
/*  231 */     Object lparam = null;
/*      */     
/*  233 */     int paramCount = getParamCount();
/*      */     
/*  235 */     for (int i = 0; i < paramCount; i++)
/*      */     {
/*  237 */       if ((this.m_paramObjects[i] instanceof boolean[]))
/*      */       {
/*  239 */         lparam = this.m_paramObjects[i];
/*  240 */         this.m_paramObjects[i] = new boolean[destRows];
/*      */         
/*  242 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  244 */       else if ((this.m_paramObjects[i] instanceof byte[]))
/*      */       {
/*  246 */         lparam = this.m_paramObjects[i];
/*  247 */         this.m_paramObjects[i] = new byte[destRows];
/*      */         
/*  249 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  251 */       else if ((this.m_paramObjects[i] instanceof short[]))
/*      */       {
/*  253 */         lparam = this.m_paramObjects[i];
/*  254 */         this.m_paramObjects[i] = new short[destRows];
/*      */         
/*  256 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  258 */       else if ((this.m_paramObjects[i] instanceof int[]))
/*      */       {
/*  260 */         lparam = this.m_paramObjects[i];
/*  261 */         this.m_paramObjects[i] = new int[destRows];
/*      */         
/*  263 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  265 */       else if ((this.m_paramObjects[i] instanceof long[]))
/*      */       {
/*  267 */         lparam = this.m_paramObjects[i];
/*  268 */         this.m_paramObjects[i] = new long[destRows];
/*      */         
/*  270 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  272 */       else if ((this.m_paramObjects[i] instanceof float[]))
/*      */       {
/*  274 */         lparam = this.m_paramObjects[i];
/*  275 */         this.m_paramObjects[i] = new float[destRows];
/*      */         
/*  277 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  279 */       else if ((this.m_paramObjects[i] instanceof double[]))
/*      */       {
/*  281 */         lparam = this.m_paramObjects[i];
/*  282 */         this.m_paramObjects[i] = new double[destRows];
/*      */         
/*  284 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  286 */       else if ((this.m_paramObjects[i] instanceof BigDecimal[]))
/*      */       {
/*  288 */         lparam = this.m_paramObjects[i];
/*  289 */         this.m_paramObjects[i] = new BigDecimal[destRows];
/*      */         
/*  291 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  293 */       else if ((this.m_paramObjects[i] instanceof java.sql.Date[]))
/*      */       {
/*  295 */         lparam = this.m_paramObjects[i];
/*  296 */         this.m_paramObjects[i] = new java.sql.Date[destRows];
/*      */         
/*  298 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  300 */       else if ((this.m_paramObjects[i] instanceof Timestamp[]))
/*      */       {
/*  302 */         lparam = this.m_paramObjects[i];
/*  303 */         this.m_paramObjects[i] = new Timestamp[destRows];
/*      */         
/*  305 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  307 */       else if ((this.m_paramObjects[i] instanceof Time[]))
/*      */       {
/*  309 */         lparam = this.m_paramObjects[i];
/*  310 */         this.m_paramObjects[i] = new Time[destRows];
/*      */         
/*  312 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  314 */       else if ((this.m_paramObjects[i] instanceof DmdbTime[]))
/*      */       {
/*  316 */         lparam = this.m_paramObjects[i];
/*  317 */         this.m_paramObjects[i] = new DmdbTime[destRows];
/*      */         
/*  319 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  321 */       else if ((this.m_paramObjects[i] instanceof DmdbIntervalDT[]))
/*      */       {
/*  323 */         lparam = this.m_paramObjects[i];
/*  324 */         this.m_paramObjects[i] = new DmdbIntervalDT[destRows];
/*      */         
/*  326 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  328 */       else if ((this.m_paramObjects[i] instanceof DmdbIntervalYM[]))
/*      */       {
/*  330 */         lparam = this.m_paramObjects[i];
/*  331 */         this.m_paramObjects[i] = new DmdbIntervalYM[destRows];
/*      */         
/*  333 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  335 */       else if ((this.m_paramObjects[i] instanceof String[]))
/*      */       {
/*  337 */         lparam = this.m_paramObjects[i];
/*  338 */         this.m_paramObjects[i] = new String[destRows];
/*      */         
/*  340 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  342 */       else if ((this.m_paramObjects[i] instanceof byte[][]))
/*      */       {
/*  344 */         lparam = this.m_paramObjects[i];
/*  345 */         this.m_paramObjects[i] = new byte[destRows][];
/*      */         
/*  347 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  349 */       else if ((this.m_paramObjects[i] instanceof Blob[]))
/*      */       {
/*  351 */         lparam = this.m_paramObjects[i];
/*  352 */         this.m_paramObjects[i] = new Blob[destRows];
/*      */         
/*  354 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  356 */       else if ((this.m_paramObjects[i] instanceof Clob[]))
/*      */       {
/*  358 */         lparam = this.m_paramObjects[i];
/*  359 */         this.m_paramObjects[i] = new Clob[destRows];
/*      */         
/*  361 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  363 */       else if ((this.m_paramObjects[i] instanceof DmReaderParam[]))
/*      */       {
/*  365 */         lparam = this.m_paramObjects[i];
/*  366 */         this.m_paramObjects[i] = new DmReaderParam[destRows];
/*      */         
/*  368 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  370 */       else if ((this.m_paramObjects[i] instanceof DmInputStreamParam[]))
/*      */       {
/*  372 */         lparam = this.m_paramObjects[i];
/*  373 */         this.m_paramObjects[i] = new DmInputStreamParam[destRows];
/*      */         
/*  375 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  377 */       else if ((this.m_paramObjects[i] instanceof ARRAY[]))
/*      */       {
/*  379 */         lparam = this.m_paramObjects[i];
/*  380 */         this.m_paramObjects[i] = new ARRAY[destRows];
/*      */         
/*  382 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       }
/*  384 */       else if ((this.m_paramObjects[i] instanceof STRUCT[]))
/*      */       {
/*  386 */         lparam = this.m_paramObjects[i];
/*  387 */         this.m_paramObjects[i] = new STRUCT[destRows];
/*      */         
/*  389 */         System.arraycopy(lparam, 0, this.m_paramObjects[i], 0, totalRows);
/*      */       } else {
/*  391 */         this.m_paramObjects[i];
/*      */       }
/*      */     }
/*      */     
/*      */ 
/*      */ 
/*  397 */     if (this.m_nullIndicator != null)
/*      */     {
/*  399 */       lparam = this.m_nullIndicator;
/*  400 */       this.m_nullIndicator = new byte[destRows][];
/*      */       
/*  402 */       System.arraycopy(lparam, 0, this.m_nullIndicator, 0, totalRows);
/*  403 */       for (int i = totalRows; 
/*  404 */           i < destRows; i++) {
/*  405 */         this.m_nullIndicator[i] = new byte[paramCount];
/*      */       }
/*      */     }
/*  408 */     this.m_rowsAllocated = destRows;
/*      */   }
/*      */   
/*      */   private void checkParamBoundInner() throws SQLException
/*      */   {
/*  413 */     int paramCount = getParamCount();
/*      */     
/*  415 */     for (int index = 0; index < paramCount; index++)
/*      */     {
/*  417 */       if ((this.m_paramsDesc[index].getIOType() != 1) && 
/*  418 */         (this.m_paramsDesc[index].getIOType() != 2) && 
/*  419 */         (this.m_paramsDesc[index].getDType() != 120))
/*      */       {
/*      */ 
/*      */ 
/*      */ 
/*  424 */         if ((this.m_bindIndicator == null) || ((this.m_bindIndicator[index] & 0x1) == 0))
/*      */         {
/*  426 */           DBError.throwSQLException(6054);
/*  427 */           break;
/*      */         }
/*      */       }
/*      */     }
/*      */   }
/*      */   
/*      */   private void addBatchInner() throws SQLException {
/*  434 */     checkParamBoundInner();
/*      */     
/*  436 */     this.m_rowIndex += 1;
/*  437 */     this.m_bindIndicator = new byte[getParamCount()];
/*      */     
/*  439 */     growBinds(this.m_rowIndex);
/*      */     
/*  441 */     this.m_isBatchOpt = true;
/*      */   }
/*      */   
/*      */   private void setObjectInner(int paramIndex, Object value) throws SQLException
/*      */   {
/*  446 */     if (value == null)
/*      */     {
/*  448 */       setNull(paramIndex, 0);
/*  449 */       return;
/*      */     }
/*      */     
/*  452 */     if ((value instanceof Boolean)) {
/*  453 */       setBooleanInner(paramIndex, ((Boolean)value).booleanValue());
/*  454 */     } else if ((value instanceof Byte)) {
/*  455 */       setByte(paramIndex, ((Byte)value).byteValue());
/*  456 */     } else if ((value instanceof Short)) {
/*  457 */       setShort(paramIndex, ((Short)value).shortValue());
/*  458 */     } else if ((value instanceof Integer)) {
/*  459 */       setIntInner(paramIndex, ((Integer)value).intValue());
/*  460 */     } else if ((value instanceof Long)) {
/*  461 */       setLongInner(paramIndex, ((Long)value).longValue());
/*  462 */     } else if ((value instanceof Float)) {
/*  463 */       setFloatInner(paramIndex, ((Float)value).floatValue());
/*  464 */     } else if ((value instanceof Double)) {
/*  465 */       setDoubleInner(paramIndex, ((Double)value).doubleValue());
/*  466 */     } else if ((value instanceof BigDecimal)) {
/*  467 */       setBigDecimalInner(paramIndex, (BigDecimal)value);
/*  468 */     } else if ((value instanceof BigInteger)) {
/*  469 */       setBigDecimalInner(paramIndex, new BigDecimal((BigInteger)value));
/*  470 */     } else if ((value instanceof java.sql.Date)) {
/*  471 */       setDateInner(paramIndex, (java.sql.Date)value);
/*  472 */     } else if ((value instanceof Timestamp)) {
/*  473 */       setTimestampInner(paramIndex, (Timestamp)value);
/*  474 */     } else if ((value instanceof Time)) {
/*  475 */       setTimeInner(paramIndex, (Time)value);
/*  476 */     } else if ((value instanceof DmdbTime)) {
/*  477 */       setTIMEInner(paramIndex, (DmdbTime)value);
/*  478 */     } else if ((value instanceof DmdbIntervalDT)) {
/*  479 */       setINTERVALDTInner(paramIndex, (DmdbIntervalDT)value);
/*  480 */     } else if ((value instanceof DmdbIntervalYM)) {
/*  481 */       setINTERVALYMInner(paramIndex, (DmdbIntervalYM)value);
/*  482 */     } else if ((value instanceof java.util.Date))
/*      */     {
/*  484 */       java.util.Date udt = (java.util.Date)value;
/*  485 */       java.sql.Date date = new java.sql.Date(udt.getTime());
/*      */       
/*  487 */       setDateInner(paramIndex, date);
/*      */     }
/*  489 */     else if ((value instanceof String)) {
/*  490 */       setStringInner(paramIndex, (String)value);
/*  491 */     } else if ((value instanceof byte[])) {
/*  492 */       setBytesInner(paramIndex, (byte[])value);
/*  493 */     } else if ((value instanceof Blob)) {
/*  494 */       setBlobInner(paramIndex, (Blob)value);
/*  495 */     } else if ((value instanceof Clob)) {
/*  496 */       setClobInner(paramIndex, (Clob)value);
/*  497 */     } else if ((value instanceof Reader)) {
/*  498 */       setReaderInner(paramIndex, (Reader)value, 0L, false);
/*  499 */     } else if ((value instanceof InputStream)) {
/*  500 */       setInputstreamInner(paramIndex, (InputStream)value, 0L, false);
/*  501 */     } else if ((value instanceof ARRAY)) {
/*  502 */       setArrayInner(paramIndex, (Array)value);
/*  503 */     } else if ((value instanceof STRUCT)) {
/*  504 */       setStructInner(paramIndex, (Struct)value);
/*  505 */     } else if ((value instanceof Character))
/*      */     {
/*  507 */       char[] chars = new char[1];
/*  508 */       chars[0] = ((Character)value).charValue();
/*      */       
/*  510 */       setStringInner(paramIndex, new String(chars));
/*      */     }
/*  512 */     else if ((value instanceof SQLData))
/*      */     {
/*  514 */       String typeName = ((SQLData)value).getSQLTypeName();
/*  515 */       if ((this.connection.getTypeMap().containsKey(typeName)) && 
/*  516 */         (value.getClass() == this.connection.getTypeMap().get(typeName)))
/*      */       {
/*  518 */         DmdbConnAgent connAgent = new DmdbConnAgent(this.connection);
/*  519 */         StructDescriptor desc = StructDescriptor.createDescriptor(typeName, connAgent);
/*  520 */         DmdbSQLOutput stream = new DmdbSQLOutput();
/*  521 */         ((SQLData)value).writeSQL(stream);
/*  522 */         STRUCT struct = new STRUCT(desc, connAgent, stream.getAttribs());
/*  523 */         setStructInner(paramIndex, struct);
/*      */       }
/*      */       else
/*      */       {
/*  527 */         DBError.throwSQLException(6007);
/*      */       }
/*      */     }
/*      */     else
/*      */     {
/*  532 */       DBError.throwUnsupportedSQLException();
/*      */     }
/*      */   }
/*      */   
/*      */   public final int getBatchSize()
/*      */   {
/*  538 */     return this.m_rowIndex;
/*      */   }
/*      */   
/*      */   public final byte[][] getNullIndicator() throws SQLException
/*      */   {
/*  543 */     return this.m_nullIndicator;
/*      */   }
/*      */   
/*      */   public final DmBinder[] getParamBoundDesc() throws SQLException
/*      */   {
/*  548 */     return this.m_curRow;
/*      */   }
/*      */   
/*      */   void checkOutParam(int paramIndex)
/*      */     throws SQLException
/*      */   {
/*  554 */     if (this.m_paramsDesc == null) {
/*  555 */       throw new SQLException(Const.res.getString("error.notOutParam"));
/*      */     }
/*  557 */     checkIndexInner(paramIndex);
/*      */     
/*  559 */     int ioType = this.m_paramsDesc[(paramIndex - 1)].getIOType();
/*  560 */     if ((ioType != 1) && (ioType != 2)) {
/*  561 */       throw new SQLException(Const.res.getString("error.notOutParam"));
/*      */     }
/*      */   }
/*      */   
/*      */   protected void regOutParam(int paramIndex, int SQLType)
/*      */     throws SQLException
/*      */   {
/*  568 */     checkOutParam(paramIndex);
/*      */     
/*  570 */     OutparamBindPrepare(paramIndex);
/*      */     
/*  572 */     DmOutParamBinder outBinder = (DmOutParamBinder)this.m_curRow[(paramIndex - 1)];
/*      */     
/*  574 */     outBinder.setSqlType(SQLType);
/*      */   }
/*      */   
/*      */   protected void regOutParam(int paramIndex, int SQLType, int sqlScale)
/*      */     throws SQLException
/*      */   {
/*  580 */     checkOutParam(paramIndex);
/*      */     
/*  582 */     OutparamBindPrepare(paramIndex);
/*      */     
/*  584 */     DmOutParamBinder outBinder = (DmOutParamBinder)this.m_curRow[(paramIndex - 1)];
/*      */     
/*  586 */     outBinder.setSqlType(SQLType);
/*  587 */     outBinder.setSqlScale(sqlScale);
/*      */   }
/*      */   
/*      */   protected void regOutParam(int paramIndex, int SQLType, String typeName)
/*      */     throws SQLException
/*      */   {
/*  593 */     checkOutParam(paramIndex);
/*      */     
/*  595 */     OutparamBindPrepare(paramIndex);
/*      */     
/*  597 */     DmOutParamBinder outBinder = (DmOutParamBinder)this.m_curRow[(paramIndex - 1)];
/*      */     
/*  599 */     outBinder.setSqlType(SQLType);
/*      */     
/*  601 */     outBinder.setTypeName(typeName);
/*      */   }
/*      */   
/*      */   public int getOutParamCount()
/*      */   {
/*  606 */     return this.m_outParamCount;
/*      */   }
/*      */   
/*      */ 
/*      */   public void copyParamValueBound(DmdbResultSetKey rsKey)
/*      */   {
/*  612 */     int paramCount = getParamCount();
/*      */     
/*  614 */     if ((paramCount <= 0) || (paramCount - getOutParamCount() <= 0)) {
/*  615 */       return;
/*      */     }
/*  617 */     rsKey.m_paramObjects = new Object[paramCount];
/*      */     
/*  619 */     for (int i = 0; i < paramCount; i++)
/*      */     {
/*  621 */       if ((this.m_paramObjects[i] instanceof boolean[]))
/*      */       {
/*  623 */         rsKey.m_paramObjects[i] = new Boolean(((boolean[])this.m_paramObjects[i])[0]);
/*      */       }
/*  625 */       else if ((this.m_paramObjects[i] instanceof byte[]))
/*      */       {
/*  627 */         rsKey.m_paramObjects[i] = new Byte(((byte[])this.m_paramObjects[i])[0]);
/*      */       }
/*  629 */       else if ((this.m_paramObjects[i] instanceof short[]))
/*      */       {
/*  631 */         rsKey.m_paramObjects[i] = new Short(((short[])this.m_paramObjects[i])[0]);
/*      */       }
/*  633 */       else if ((this.m_paramObjects[i] instanceof int[]))
/*      */       {
/*  635 */         rsKey.m_paramObjects[i] = new Integer(((int[])this.m_paramObjects[i])[0]);
/*      */       }
/*  637 */       else if ((this.m_paramObjects[i] instanceof long[]))
/*      */       {
/*  639 */         rsKey.m_paramObjects[i] = new Long(((long[])this.m_paramObjects[i])[0]);
/*      */       }
/*  641 */       else if ((this.m_paramObjects[i] instanceof float[]))
/*      */       {
/*  643 */         rsKey.m_paramObjects[i] = new Float(((float[])this.m_paramObjects[i])[0]);
/*      */       }
/*  645 */       else if ((this.m_paramObjects[i] instanceof double[]))
/*      */       {
/*  647 */         rsKey.m_paramObjects[i] = new Double(((double[])this.m_paramObjects[i])[0]);
/*      */       }
/*  649 */       else if ((this.m_paramObjects[i] instanceof BigDecimal[]))
/*      */       {
/*  651 */         rsKey.m_paramObjects[i] = ((BigDecimal[])this.m_paramObjects[i])[0];
/*      */       }
/*  653 */       else if ((this.m_paramObjects[i] instanceof java.sql.Date[]))
/*      */       {
/*  655 */         rsKey.m_paramObjects[i] = ((java.sql.Date[])this.m_paramObjects[i])[0].clone();
/*      */       }
/*  657 */       else if ((this.m_paramObjects[i] instanceof Timestamp[]))
/*      */       {
/*  659 */         rsKey.m_paramObjects[i] = ((Timestamp[])this.m_paramObjects[i])[0].clone();
/*      */       }
/*  661 */       else if ((this.m_paramObjects[i] instanceof Time[]))
/*      */       {
/*  663 */         rsKey.m_paramObjects[i] = ((Time[])this.m_paramObjects[i])[0].clone();
/*      */       }
/*  665 */       else if ((this.m_paramObjects[i] instanceof DmdbTime[]))
/*      */       {
/*  667 */         rsKey.m_paramObjects[i] = ((DmdbTime[])this.m_paramObjects[i])[0].clone();
/*      */       }
/*  669 */       else if ((this.m_paramObjects[i] instanceof DmdbIntervalDT[]))
/*      */       {
/*  671 */         rsKey.m_paramObjects[i] = ((DmdbIntervalDT[])this.m_paramObjects[i])[0].clone();
/*      */       }
/*  673 */       else if ((this.m_paramObjects[i] instanceof DmdbIntervalYM[]))
/*      */       {
/*  675 */         rsKey.m_paramObjects[i] = ((DmdbIntervalYM[])this.m_paramObjects[i])[0].clone();
/*      */       }
/*  677 */       else if ((this.m_paramObjects[i] instanceof String[]))
/*      */       {
/*  679 */         rsKey.m_paramObjects[i] = ((String[])this.m_paramObjects[i])[0];
/*      */       }
/*  681 */       else if ((this.m_paramObjects[i] instanceof byte[][]))
/*      */       {
/*  683 */         int len = ((byte[][])this.m_paramObjects[i])[0].length;
/*  684 */         rsKey.m_paramObjects[i] = new byte[len];
/*  685 */         System.arraycopy(((byte[][])this.m_paramObjects[i])[0], 0, (byte[])rsKey.m_paramObjects[i], 0, 
/*  686 */           len);
/*      */       }
/*      */     }
/*      */   }
/*      */   
/*      */   public int getParamCount()
/*      */   {
/*  693 */     if (this.m_paramsDesc == null) {
/*  694 */       return 0;
/*      */     }
/*  696 */     return this.m_paramsDesc.length;
/*      */   }
/*      */   
/*      */   void initializeParam(boolean closeFlag) throws SQLException
/*      */   {
/*  701 */     if (closeFlag)
/*      */     {
/*  703 */       this.m_outParamCount = 0;
/*  704 */       this.m_curRow = null;
/*  705 */       this.m_bindIndicator = null;
/*  706 */       this.m_rowIndex = -1;
/*  707 */       this.m_paramObjects = null;
/*  708 */       this.m_isBatchOpt = false;
/*      */       
/*  710 */       return;
/*      */     }
/*      */     
/*  713 */     if (this.m_paramsDesc == null)
/*      */     {
/*  715 */       this.m_outParamCount = 0;
/*  716 */       if (this.m_curRow == null)
/*      */       {
/*  718 */         this.m_curRow = new DmBinder[0];
/*      */       }
/*      */       
/*  721 */       this.m_bindIndicator = null;
/*  722 */       this.m_rowIndex = -1;
/*  723 */       this.m_paramObjects = null;
/*  724 */       this.m_isBatchOpt = false;
/*      */       
/*  726 */       return;
/*      */     }
/*      */     
/*  729 */     this.m_rowIndex = -1;
/*  730 */     this.m_rowsAllocated = 500;
/*      */     
/*  732 */     int paramCount = getParamCount();
/*      */     
/*  734 */     if (this.m_curRow != null)
/*      */     {
/*  736 */       for (int i = 0; i < paramCount; i++)
/*      */       {
/*  738 */         if (this.m_curRow[i] != null)
/*      */         {
/*  740 */           if ((this.m_curRow[i] instanceof DmOutParamBinder))
/*      */           {
/*  742 */             this.m_curRow[i].setInoutParamBinder(null);
/*  743 */             if (this.m_paramsDesc[i].getIOType() == 2) {
/*  744 */               this.m_curRow[i].setInoutParamBinder(new DmNullBinder(this));
/*      */             }
/*      */           }
/*      */           else {
/*  748 */             this.m_curRow[i] = new DmNullBinder(this);
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */     else
/*      */     {
/*  755 */       this.m_curRow = new DmBinder[paramCount];
/*      */       
/*  757 */       this.m_outParamCount = 0;
/*  758 */       for (int i = 0; i < paramCount; i++)
/*      */       {
/*  760 */         if (this.m_paramsDesc[i].getIOType() == 0)
/*      */         {
/*  762 */           this.m_curRow[i] = new DmNullBinder(this);
/*      */         }
/*      */         else
/*      */         {
/*  766 */           this.m_curRow[i] = new DmOutParamBinder(this);
/*  767 */           this.m_outParamCount += 1;
/*  768 */           if (this.m_paramsDesc[i].getIOType() == 2)
/*      */           {
/*  770 */             this.m_curRow[i].setInoutParamBinder(new DmNullBinder(this));
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */     
/*  776 */     this.m_paramObjects = new Object[paramCount];
/*  777 */     this.m_nullIndicator = new byte[this.m_rowsAllocated][paramCount];
/*      */     
/*      */ 
/*  780 */     this.m_bindIndicator = new byte[paramCount];
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   void initialize(String sql)
/*      */     throws SQLException
/*      */   {
/*      */     try
/*      */     {
/*  797 */       checkNullOrEmpty(sql);
/*      */       
/*  799 */       this.originalSql = this.connection.nativeSQL(sql, this.process_escapes);
/*      */       
/*  801 */       transReadOnlyCheck(this.originalSql);
/*      */       
/*  803 */       this.dbInfo = null;
/*      */       
/*  805 */       if (this.dbInfo == null) {
/*  806 */         this.dbInfo = directExec(this, this.originalSql, false, 0);
/*      */       }
/*  808 */       this.m_paramsDesc = this.dbInfo.getParamsInfo();
/*      */       
/*  810 */       initializeParam(false);
/*      */       
/*  812 */       this.type = 1;
/*      */       
/*  814 */       this.m_insertTableName = getTableNameBySql(this.originalSql);
/*      */ 
/*      */     }
/*      */     catch (SQLException e)
/*      */     {
/*  819 */       close();
/*  820 */       throw e;
/*      */     }
/*      */   }
/*      */   
/*      */   void initializeReusePreparedStmt(DmdbConnection_bs conn, String sql) throws SQLException
/*      */   {
/*  826 */     super.initializeReuseStmt(conn);
/*      */     
/*  828 */     this.type = 1;
/*      */   }
/*      */   
/*      */   public DmdbPreparedStatement_bs(DmdbConnection_bs conn, String sql) throws SQLException
/*      */   {
/*  833 */     super(conn);
/*  834 */     initialize(sql);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public DmdbPreparedStatement_bs(DmdbConnection_bs conn, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
/*      */     throws SQLException
/*      */   {
/*  850 */     super(conn, resultSetType, resultSetConcurrency, resultSetHoldability);
/*  851 */     initialize(sql);
/*      */   }
/*      */   
/*      */   protected DmdbPreparedStatement_bs(DmdbConnection_bs conn, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys)
/*      */     throws SQLException
/*      */   {
/*  857 */     super(conn, resultSetType, resultSetConcurrency, resultSetHoldability);
/*      */     
/*  859 */     setAutoGetKeysInner(autoGeneratedKeys);
/*  860 */     initialize(sql);
/*      */   }
/*      */   
/*      */   protected DmdbPreparedStatement_bs(DmdbConnection_bs conn, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int[] columnIndexes)
/*      */     throws SQLException
/*      */   {
/*  866 */     super(conn, resultSetType, resultSetConcurrency, resultSetHoldability);
/*      */     
/*  868 */     if ((columnIndexes != null) && (columnIndexes.length > 0)) {
/*  869 */       setAutoGetKeys(true);
/*      */     } else {
/*  871 */       setAutoGetKeys(false);
/*      */     }
/*  873 */     initialize(sql);
/*      */   }
/*      */   
/*      */   protected DmdbPreparedStatement_bs(DmdbConnection_bs conn, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, String[] columnNames)
/*      */     throws SQLException
/*      */   {
/*  879 */     super(conn, resultSetType, resultSetConcurrency, resultSetHoldability);
/*      */     
/*  881 */     if ((columnNames != null) && (columnNames.length > 0)) {
/*  882 */       setAutoGetKeys(true);
/*      */     } else {
/*  884 */       setAutoGetKeys(false);
/*      */     }
/*  886 */     initialize(sql);
/*      */   }
/*      */   
/*      */   protected DmdbPreparedStatement_bs(DmdbConnection_bs conn, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
/*      */     throws SQLException
/*      */   {
/*  892 */     super(conn, resultSetType, resultSetConcurrency, resultSetHoldability);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized ResultSet executeQuery()
/*      */     throws SQLException
/*      */   {
/*  902 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/*  904 */       DmdbLog.trace(this, "executeQuery()", "");
/*      */     }
/*      */     
/*  907 */     executeInner(0, 2);
/*      */     
/*  909 */     if ((this instanceof DmdbCallableStatement_bs))
/*      */     {
/*  911 */       ((DmdbCallableStatement_bs)this).colsInfo = new ArrayList(
/*  912 */         ((DmdbCallableStatement_bs)this).resultsCount);
/*  913 */       ((DmdbCallableStatement_bs)this).colsInfo.add(this.dbInfo.getColumnsInfo());
/*  914 */       this.rsCache = null;
/*      */     }
/*      */     
/*  917 */     return this.currentRs;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized ResultSet executeQuery2()
/*      */     throws SQLException
/*      */   {
/*  928 */     this.fromRowSetFlag = true;
/*      */     
/*  930 */     executeInner(0, 4);
/*      */     
/*  932 */     return this.currentRs;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public int executeUpdate()
/*      */     throws SQLException
/*      */   {
/*  950 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/*  952 */       DmdbLog.trace(this, "executeUpdate()", "");
/*      */     }
/*      */     
/*  955 */     return executeUpdate_ex(0);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setNull(int parameterIndex, int sqlType)
/*      */     throws SQLException
/*      */   {
/*  969 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/*  971 */       DmdbLog.trace(this, "setNull()", "colid = " + parameterIndex + ", sqlType is " + sqlType);
/*      */     }
/*      */     
/*  974 */     paramBindPrepare(parameterIndex);
/*      */     
/*  976 */     setNullInner(parameterIndex);
/*      */   }
/*      */   
/*      */   private void setNullInner(int parameterIndex) throws SQLException
/*      */   {
/*  981 */     int paramCount = getParamCount();
/*      */     
/*  983 */     if (this.m_nullIndicator == null) {
/*  984 */       this.m_nullIndicator = new byte[this.m_rowsAllocated][paramCount];
/*      */     }
/*  986 */     this.m_nullIndicator[this.m_rowIndex][(parameterIndex - 1)] = 1;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setBoolean(int parameterIndex, boolean x)
/*      */     throws SQLException
/*      */   {
/* 1000 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1002 */       DmdbLog.trace(this, "setBoolean()", "colid = " + parameterIndex + ", boolean is " + x);
/*      */     }
/*      */     
/* 1005 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1007 */     setBooleanInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setBooleanInner(int parameterIndex, boolean x) throws SQLException
/*      */   {
/* 1012 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1013 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmBooleanBinder(this));
/* 1014 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1015 */       this.m_curRow[(parameterIndex - 1)] = new DmBooleanBinder(this);
/* 1016 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmBooleanBinder)) {
/* 1017 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1019 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1020 */       this.m_paramObjects[(parameterIndex - 1)] = new boolean[this.m_rowsAllocated];
/*      */     }
/* 1022 */     ((boolean[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setByte(int parameterIndex, byte x)
/*      */     throws SQLException
/*      */   {
/* 1036 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1038 */       DmdbLog.trace(this, "setByte()", "colid = " + parameterIndex + ", byte is " + x);
/*      */     }
/*      */     
/* 1041 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1043 */     setByteInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setByteInner(int parameterIndex, byte x) throws SQLException
/*      */   {
/* 1048 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1049 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmByteBinder(this));
/* 1050 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1051 */       this.m_curRow[(parameterIndex - 1)] = new DmByteBinder(this);
/* 1052 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmByteBinder)) {
/* 1053 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1055 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1056 */       this.m_paramObjects[(parameterIndex - 1)] = new byte[this.m_rowsAllocated];
/*      */     }
/* 1058 */     ((byte[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setShort(int parameterIndex, short x)
/*      */     throws SQLException
/*      */   {
/* 1072 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1074 */       DmdbLog.trace(this, "setShort()", "colid = " + parameterIndex + ", short is " + x);
/*      */     }
/*      */     
/* 1077 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1079 */     setShortInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setShortInner(int parameterIndex, short x) throws SQLException
/*      */   {
/* 1084 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1085 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmShortBinder(this));
/* 1086 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1087 */       this.m_curRow[(parameterIndex - 1)] = new DmShortBinder(this);
/* 1088 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmShortBinder)) {
/* 1089 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1091 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1092 */       this.m_paramObjects[(parameterIndex - 1)] = new short[this.m_rowsAllocated];
/*      */     }
/* 1094 */     ((short[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setInt(int parameterIndex, int x)
/*      */     throws SQLException
/*      */   {
/* 1108 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1110 */       DmdbLog.trace(this, "setInt()", "colid = " + parameterIndex + ", int is " + x);
/*      */     }
/*      */     
/* 1113 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1115 */     setIntInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setIntInner(int parameterIndex, int x) throws SQLException
/*      */   {
/* 1120 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1121 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmIntBinder(this));
/* 1122 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1123 */       this.m_curRow[(parameterIndex - 1)] = new DmIntBinder(this);
/* 1124 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmIntBinder)) {
/* 1125 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1127 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1128 */       this.m_paramObjects[(parameterIndex - 1)] = new int[this.m_rowsAllocated];
/*      */     }
/* 1130 */     ((int[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setLong(int parameterIndex, long x)
/*      */     throws SQLException
/*      */   {
/* 1144 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1146 */       DmdbLog.trace(this, "setLong()", "colid = " + parameterIndex + ", long is " + x);
/*      */     }
/*      */     
/* 1149 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1151 */     setLongInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setLongInner(int parameterIndex, long x) throws SQLException
/*      */   {
/* 1156 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1157 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmLongBinder(this));
/* 1158 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1159 */       this.m_curRow[(parameterIndex - 1)] = new DmLongBinder(this);
/* 1160 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmLongBinder)) {
/* 1161 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1163 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1164 */       this.m_paramObjects[(parameterIndex - 1)] = new long[this.m_rowsAllocated];
/*      */     }
/* 1166 */     ((long[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setFloat(int parameterIndex, float x)
/*      */     throws SQLException
/*      */   {
/* 1180 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1182 */       DmdbLog.trace(this, "setFloat()", "colid = " + parameterIndex + ", float is " + x);
/*      */     }
/*      */     
/* 1185 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1187 */     setFloatInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setFloatInner(int parameterIndex, float x) throws SQLException
/*      */   {
/* 1192 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1193 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmFloatBinder(this));
/* 1194 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1195 */       this.m_curRow[(parameterIndex - 1)] = new DmFloatBinder(this);
/* 1196 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmFloatBinder)) {
/* 1197 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1199 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1200 */       this.m_paramObjects[(parameterIndex - 1)] = new float[this.m_rowsAllocated];
/*      */     }
/* 1202 */     ((float[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setDouble(int parameterIndex, double x)
/*      */     throws SQLException
/*      */   {
/* 1216 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1218 */       DmdbLog.trace(this, "setDouble()", "colid = " + parameterIndex + ", double is " + x);
/*      */     }
/*      */     
/* 1221 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1223 */     setDoubleInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setDoubleInner(int parameterIndex, double x) throws SQLException
/*      */   {
/* 1228 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1229 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmDoubleBinder(this));
/* 1230 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1231 */       this.m_curRow[(parameterIndex - 1)] = new DmDoubleBinder(this);
/* 1232 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmDoubleBinder)) {
/* 1233 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1235 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1236 */       this.m_paramObjects[(parameterIndex - 1)] = new double[this.m_rowsAllocated];
/*      */     }
/* 1238 */     ((double[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setBigDecimal(int parameterIndex, BigDecimal x)
/*      */     throws SQLException
/*      */   {
/* 1252 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1254 */       if (x == null) {
/* 1255 */         DmdbLog.trace(this, "setBigDecimal()", "colid = " + parameterIndex + ", BigDecimal is null");
/*      */       } else {
/* 1257 */         DmdbLog.trace(this, "setBigDecimal()", 
/* 1258 */           "colid = " + parameterIndex + ", BigDecimal is " + x.toString());
/*      */       }
/*      */     }
/*      */     
/* 1262 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1264 */     setBigDecimalInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setBigDecimalInner(int parameterIndex, BigDecimal x) throws SQLException
/*      */   {
/* 1269 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1270 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmBigDecBinder(this));
/* 1271 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1272 */       this.m_curRow[(parameterIndex - 1)] = new DmBigDecBinder(this);
/* 1273 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmBigDecBinder)) {
/* 1274 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1276 */     if (x == null)
/*      */     {
/* 1278 */       setNullInner(parameterIndex);
/* 1279 */       return;
/*      */     }
/*      */     
/* 1282 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1283 */       this.m_paramObjects[(parameterIndex - 1)] = new BigDecimal[this.m_rowsAllocated];
/*      */     }
/* 1285 */     ((BigDecimal[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setString(int parameterIndex, String x)
/*      */     throws SQLException
/*      */   {
/* 1301 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1303 */       if (x == null) {
/* 1304 */         DmdbLog.trace(this, "setString()", "colid = " + parameterIndex + ", string is null");
/*      */       } else {
/* 1306 */         DmdbLog.trace(this, "setString()", "colid = " + parameterIndex + ", string is " + x);
/*      */       }
/*      */     }
/* 1309 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1311 */     setStringInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setStringInner(int parameterIndex, String x) throws SQLException
/*      */   {
/* 1316 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1317 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmStringBinder(this, x == null ? 0 : x
/* 1318 */         .length()));
/* 1319 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1320 */       this.m_curRow[(parameterIndex - 1)] = new DmStringBinder(this, x == null ? 0 : x.length());
/* 1321 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmStringBinder)) {
/* 1322 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1324 */     if ((x == null) || (
/* 1325 */       (x.length() == 0) && 
/* 1326 */       (DmdbType.emptyStringToNull(this.m_paramsDesc[(parameterIndex - 1)].getDType()))))
/*      */     {
/* 1328 */       setNullInner(parameterIndex);
/* 1329 */       return;
/*      */     }
/*      */     
/* 1332 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1333 */       this.m_paramObjects[(parameterIndex - 1)] = new String[this.m_rowsAllocated];
/*      */     }
/* 1335 */     ((String[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setBytes(int parameterIndex, byte[] x)
/*      */     throws SQLException
/*      */   {
/* 1351 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1353 */       if (x == null) {
/* 1354 */         DmdbLog.trace(this, "setBytes()", "colid = " + parameterIndex + ", bytes is null");
/*      */       } else {
/* 1356 */         DmdbLog.trace(this, "setBytes()", "colid = " + parameterIndex + ", bytes is " + x.toString());
/*      */       }
/*      */     }
/* 1359 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1361 */     setBytesInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setBytesInner(int parameterIndex, byte[] x) throws SQLException
/*      */   {
/* 1366 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1367 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmByteArrBinder(this));
/* 1368 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1369 */       this.m_curRow[(parameterIndex - 1)] = new DmByteArrBinder(this);
/* 1370 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmByteArrBinder)) {
/* 1371 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1373 */     if (x == null)
/*      */     {
/* 1375 */       setNullInner(parameterIndex);
/* 1376 */       return;
/*      */     }
/*      */     
/* 1379 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1380 */       this.m_paramObjects[(parameterIndex - 1)] = new byte[this.m_rowsAllocated][];
/*      */     }
/* 1382 */     ((byte[][])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setDate(int parameterIndex, java.sql.Date x)
/*      */     throws SQLException
/*      */   {
/* 1396 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1398 */       if (x == null) {
/* 1399 */         DmdbLog.trace(this, "setDate()", "colid = " + parameterIndex + ", date is null");
/*      */       } else {
/* 1401 */         DmdbLog.trace(this, "setDate()", "colid = " + parameterIndex + ", date is " + x.toString());
/*      */       }
/*      */     }
/* 1404 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1406 */     setDateInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setDateInner(int parameterIndex, java.sql.Date x) throws SQLException
/*      */   {
/* 1411 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1412 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmDateBinder(this));
/* 1413 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1414 */       this.m_curRow[(parameterIndex - 1)] = new DmDateBinder(this);
/* 1415 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmDateBinder)) {
/* 1416 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1418 */     if (x == null)
/*      */     {
/* 1420 */       setNullInner(parameterIndex);
/* 1421 */       return;
/*      */     }
/*      */     
/* 1424 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1425 */       this.m_paramObjects[(parameterIndex - 1)] = new java.sql.Date[this.m_rowsAllocated];
/*      */     }
/* 1427 */     ((java.sql.Date[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setTime(int parameterIndex, Time x)
/*      */     throws SQLException
/*      */   {
/* 1441 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1443 */       if (x == null) {
/* 1444 */         DmdbLog.trace(this, "setTime()", "colid = " + parameterIndex + ", time is null");
/*      */       } else {
/* 1446 */         DmdbLog.trace(this, "setTime()", "colid = " + parameterIndex + ", time is " + x);
/*      */       }
/*      */     }
/* 1449 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1451 */     setTimeInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setTimeInner(int parameterIndex, Time x) throws SQLException
/*      */   {
/* 1456 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1457 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmTimeBinder(this));
/* 1458 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1459 */       this.m_curRow[(parameterIndex - 1)] = new DmTimeBinder(this);
/* 1460 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmTimeBinder)) {
/* 1461 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1463 */     if (x == null)
/*      */     {
/* 1465 */       setNullInner(parameterIndex);
/* 1466 */       return;
/*      */     }
/*      */     
/* 1469 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1470 */       this.m_paramObjects[(parameterIndex - 1)] = new Time[this.m_rowsAllocated];
/*      */     }
/* 1472 */     ((Time[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setTimestamp(int parameterIndex, Timestamp x)
/*      */     throws SQLException
/*      */   {
/* 1486 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1488 */       if (x == null) {
/* 1489 */         DmdbLog.trace(this, "setTimestamp()", "colid = " + parameterIndex + ", timestamp is null");
/*      */       } else {
/* 1491 */         DmdbLog.trace(this, "setTimestamp()", "colid = " + parameterIndex + ", timestamp is " + x);
/*      */       }
/*      */     }
/* 1494 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1496 */     setTimestampInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */   private void setTimestampInner(int parameterIndex, Timestamp x) throws SQLException
/*      */   {
/* 1501 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1502 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmTimestampBinder(this));
/* 1503 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1504 */       this.m_curRow[(parameterIndex - 1)] = new DmTimestampBinder(this);
/* 1505 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmTimestampBinder)) {
/* 1506 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1508 */     if (x == null)
/*      */     {
/* 1510 */       setNullInner(parameterIndex);
/* 1511 */       return;
/*      */     }
/*      */     
/* 1514 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1515 */       this.m_paramObjects[(parameterIndex - 1)] = new Timestamp[this.m_rowsAllocated];
/*      */     }
/* 1517 */     ((Timestamp[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized void setAsciiStream(int parameterIndex, InputStream x, int length)
/*      */     throws SQLException
/*      */   {
/* 1539 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1541 */       if (x == null) {
/* 1542 */         DmdbLog.trace(this, "setAsciiStream()", "colid = " + parameterIndex + ", InputStream is null");
/*      */       } else
/* 1544 */         DmdbLog.trace(this, "setAsciiStream()", 
/* 1545 */           "colid = " + parameterIndex + ", InputStream is " + x.toString() + ", length = " + 
/* 1546 */           length);
/*      */     }
/* 1548 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1550 */     setInputstreamInner(parameterIndex, x, length, true);
/*      */   }
/*      */   
/*      */   private void setInputstreamInner(int parameterIndex, InputStream x, long length, boolean hasLength)
/*      */     throws SQLException
/*      */   {
/* 1556 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 1557 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmInputStreamBinder(this));
/* 1558 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 1559 */       this.m_curRow[(parameterIndex - 1)] = new DmInputStreamBinder(this);
/* 1560 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmInputStreamBinder)) {
/* 1561 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 1563 */     if (x == null)
/*      */     {
/* 1565 */       setNullInner(parameterIndex);
/* 1566 */       return;
/*      */     }
/*      */     
/* 1569 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 1570 */       this.m_paramObjects[(parameterIndex - 1)] = new DmInputStreamParam[this.m_rowsAllocated];
/*      */     }
/* 1572 */     if (hasLength) {
/* 1573 */       ((DmInputStreamParam[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = new DmInputStreamParam(
/* 1574 */         x, length);
/*      */     } else {
/* 1576 */       ((DmInputStreamParam[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = new DmInputStreamParam(x);
/*      */     }
/*      */   }
/*      */   
/*      */   public synchronized void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
/*      */   {
/* 1582 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1584 */       if (x == null) {
/* 1585 */         DmdbLog.trace(this, "setAsciiStream()", "colid = " + parameterIndex + ", InputStream is null");
/*      */       } else {
/* 1587 */         DmdbLog.trace(this, "setAsciiStream()", 
/* 1588 */           "colid = " + parameterIndex + ", InputStream is " + x.toString() + ", length = " + 
/* 1589 */           length);
/*      */       }
/*      */     }
/* 1592 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1594 */     setInputstreamInner(parameterIndex, x, length, true);
/*      */   }
/*      */   
/*      */   public synchronized void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
/*      */   {
/* 1599 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1601 */       if (x == null) {
/* 1602 */         DmdbLog.trace(this, "setAsciiStream()", "colid = " + parameterIndex + ", InputStream is null");
/*      */       } else {
/* 1604 */         DmdbLog.trace(this, "setAsciiStream()", 
/* 1605 */           "colid = " + parameterIndex + ", InputStream is " + x.toString());
/*      */       }
/*      */     }
/*      */     
/* 1609 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1611 */     setInputstreamInner(parameterIndex, x, 0L, false);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   /**
/*      */    * @deprecated
/*      */    */
/*      */   public synchronized void setUnicodeStream(int parameterIndex, InputStream x, int length)
/*      */     throws SQLException
/*      */   {
/* 1638 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1640 */       if (x == null) {
/* 1641 */         DmdbLog.trace(this, "setUnicodeStream()", "colid = " + parameterIndex + 
/* 1642 */           ", inputStream is null");
/*      */       } else {
/* 1644 */         DmdbLog.trace(this, "setUnicodeStream()", "colid = " + parameterIndex + ", inputStream is " + 
/* 1645 */           x + ", length = " + length);
/*      */       }
/*      */     }
/* 1648 */     paramBindPrepare(parameterIndex);
/*      */     
/*      */ 
/* 1651 */     setInputstreamInner(parameterIndex, x, length, true);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized void setBinaryStream(int parameterIndex, InputStream x, int length)
/*      */     throws SQLException
/*      */   {
/* 1672 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1674 */       if (x == null) {
/* 1675 */         DmdbLog.trace(this, "setBinaryStream()", "colid = " + parameterIndex + 
/* 1676 */           ", InputStream is null");
/*      */       } else {
/* 1678 */         DmdbLog.trace(this, "setBinaryStream()", "colid = " + parameterIndex + ", InputStream is " + 
/* 1679 */           x.toString() + ", length = " + length);
/*      */       }
/*      */     }
/*      */     
/* 1683 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1685 */     setInputstreamInner(parameterIndex, x, length, true);
/*      */   }
/*      */   
/*      */   public synchronized void setBinaryStream(int parameterIndex, InputStream x, long length)
/*      */     throws SQLException
/*      */   {
/* 1691 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1693 */       if (x == null) {
/* 1694 */         DmdbLog.trace(this, "setBinaryStream()", "colid = " + parameterIndex + 
/* 1695 */           ", InputStream is null");
/*      */       } else {
/* 1697 */         DmdbLog.trace(this, "setBinaryStream()", "colid = " + parameterIndex + ", InputStream is " + 
/* 1698 */           x.toString() + ", length = " + length);
/*      */       }
/*      */     }
/* 1701 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1703 */     setInputstreamInner(parameterIndex, x, length, true);
/*      */   }
/*      */   
/*      */   public synchronized void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
/*      */   {
/* 1708 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1710 */       if (x == null) {
/* 1711 */         DmdbLog.trace(this, "setBinaryStream()", "colid = " + parameterIndex + 
/* 1712 */           ", InputStream is null");
/*      */       } else {
/* 1714 */         DmdbLog.trace(this, "setBinaryStream()", "colid = " + parameterIndex + ", InputStream is " + 
/* 1715 */           x.toString());
/*      */       }
/*      */     }
/*      */     
/* 1719 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1721 */     setInputstreamInner(parameterIndex, x, 0L, false);
/*      */   }
/*      */   
/*      */   public void clearOutParamVal() throws SQLException
/*      */   {
/* 1726 */     if (this.m_curRow != null)
/*      */     {
/* 1728 */       int paramCount = getParamCount();
/*      */       
/* 1730 */       for (int i = 0; i < paramCount; i++)
/*      */       {
/* 1732 */         if (this.m_curRow[i] != null)
/*      */         {
/* 1734 */           if ((this.m_curRow[i] instanceof DmOutParamBinder))
/*      */           {
/* 1736 */             DmOutParamBinder outBinder = (DmOutParamBinder)this.m_curRow[i];
/*      */             
/* 1738 */             if (this.m_paramsDesc[i].getDType() == 120)
/*      */             {
/* 1740 */               DmdbStatement_bs stmt = (DmdbStatement_bs)this.connection.createStatement();
/* 1741 */               stmt.setFromStandby(getFromStandby());
/* 1742 */               outBinder.setCursorStmt(stmt);
/*      */             }
/*      */             
/* 1745 */             outBinder.setOutValue(null);
/* 1746 */             outBinder.setOutNullFlag(false);
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */   }
/*      */   
/*      */   public synchronized void clearParameters()
/*      */     throws SQLException
/*      */   {
/* 1756 */     initializeParam(false);
/*      */   }
/*      */   
/*      */   void resetState() throws SQLException
/*      */   {
/* 1761 */     super.resetState(false);
/* 1762 */     this.printMsg = null;
/*      */   }
/*      */   
/*      */   public synchronized void close() throws SQLException
/*      */   {
/* 1767 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1769 */       DmdbLog.trace(this, "close()", "");
/*      */     }
/*      */     
/* 1772 */     if (this.closed)
/*      */     {
/* 1774 */       return;
/*      */     }
/*      */     
/* 1777 */     if (this.currentRs != null)
/*      */     {
/* 1779 */       this.currentRs.close();
/* 1780 */       this.currentRs = null;
/*      */     }
/*      */     
/* 1783 */     if ((this.connection != null) && (!this.connection.closed) && (!this.realClose) && 
/* 1784 */       (this.connection.getStmtPoolMaxSize() > 0))
/*      */     {
/* 1786 */       resetState();
/*      */       
/* 1788 */       clearWarnings();
/* 1789 */       clearBatch();
/*      */       
/* 1791 */       this.closed = true;
/*      */       
/* 1793 */       this.connection.remove_statement(this.handle);
/* 1794 */       this.connection.addToPreparedStmtPool(this);
/*      */       
/* 1796 */       return;
/*      */     }
/*      */     
/* 1799 */     super.close();
/* 1800 */     this.dbInfo = null;
/* 1801 */     this.m_paramsDesc = null;
/* 1802 */     this.m_curRow = null;
/* 1803 */     this.realClose = false;
/* 1804 */     initializeParam(true);
/*      */   }
/*      */   
/*      */   public synchronized void innerClose()
/*      */     throws SQLException
/*      */   {
/* 1810 */     if (this.currentRs != null)
/*      */     {
/* 1812 */       this.currentRs.close();
/* 1813 */       this.currentRs = null;
/*      */     }
/*      */     
/* 1816 */     super.innerClose();
/* 1817 */     this.dbInfo = null;
/* 1818 */     this.m_paramsDesc = null;
/* 1819 */     this.m_outParamCount = 0;
/* 1820 */     this.realClose = false;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   private boolean isValidDecimalObject(Object x)
/*      */   {
/* 1858 */     if (x == null) {
/* 1859 */       return false;
/*      */     }
/* 1861 */     if (((x instanceof BigDecimal)) || ((x instanceof Boolean)) || ((x instanceof Byte)) || ((x instanceof Double)) || 
/* 1862 */       ((x instanceof Float)) || ((x instanceof Integer)) || ((x instanceof Long)) || ((x instanceof Short)) || 
/* 1863 */       ((x instanceof String))) {
/* 1864 */       return true;
/*      */     }
/* 1866 */     return false;
/*      */   }
/*      */   
/*      */   public synchronized void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
/*      */     throws SQLException
/*      */   {
/* 1872 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1874 */       if (x == null) {
/* 1875 */         DmdbLog.trace(this, "setObject()", "colid = " + parameterIndex + ", x is null");
/*      */       } else {
/* 1877 */         DmdbLog.trace(this, "setObject()", "colid = " + parameterIndex + ", x is " + x.toString());
/*      */       }
/*      */     }
/* 1880 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1882 */     if (((targetSqlType == 3) || (targetSqlType == 2)) && 
/* 1883 */       (isValidDecimalObject(x)))
/*      */     {
/*      */ 
/* 1886 */       String strValue = "";
/*      */       
/* 1888 */       if ((x instanceof Boolean)) {
/* 1889 */         strValue = ((Boolean)x).booleanValue() ? "1" : "0";
/*      */       } else {
/* 1891 */         strValue = String.valueOf(x);
/*      */       }
/* 1893 */       BigDecimal bgd = new BigDecimal(strValue);
/* 1894 */       x = bgd.setScale(scale, 4);
/*      */     }
/*      */     
/* 1897 */     setObjectInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setObject(int parameterIndex, Object x, int targetSqlType)
/*      */     throws SQLException
/*      */   {
/* 1914 */     setObject(parameterIndex, x, targetSqlType, this.m_paramsDesc[(parameterIndex - 1)].getScale());
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized void setObject(int parameterIndex, Object x)
/*      */     throws SQLException
/*      */   {
/* 1949 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1951 */       if (x == null) {
/* 1952 */         DmdbLog.trace(this, "setObject()", "colid = " + parameterIndex + ", x is null");
/*      */       } else {
/* 1954 */         DmdbLog.trace(this, "setObject()", "colid = " + parameterIndex + ", x is " + x.toString());
/*      */       }
/*      */     }
/* 1957 */     paramBindPrepare(parameterIndex);
/*      */     
/* 1959 */     setObjectInner(parameterIndex, x);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized boolean execute()
/*      */     throws SQLException
/*      */   {
/* 1987 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 1989 */       DmdbLog.trace(this, "execute()", "");
/*      */     }
/*      */     
/* 1992 */     executeInner(0, 1);
/*      */     
/* 1994 */     if ((this instanceof DmdbCallableStatement_bs))
/*      */     {
/* 1996 */       ((DmdbCallableStatement_bs)this).colsInfo = new ArrayList(
/* 1997 */         ((DmdbCallableStatement_bs)this).resultsCount);
/* 1998 */       ((DmdbCallableStatement_bs)this).colsInfo.add(this.dbInfo.getColumnsInfo());
/* 1999 */       this.rsCache = null;
/*      */     }
/*      */     
/* 2002 */     return this.dbInfo.getHasResultSet();
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void addBatch()
/*      */     throws SQLException
/*      */   {
/* 2017 */     addBatchInner();
/*      */   }
/*      */   
/*      */   private boolean checkBatch()
/*      */   {
/* 2022 */     if (this.m_rowIndex >= 0) {
/* 2023 */       return true;
/*      */     }
/* 2025 */     return false;
/*      */   }
/*      */   
/*      */   private int[] executeBatchNot() throws SQLException
/*      */   {
/*      */     try
/*      */     {
/* 2032 */       int nbrCommands = this.m_rowIndex;
/* 2033 */       int[] updateCounts = new int[nbrCommands];
/*      */       
/* 2035 */       for (int i = 0; i < nbrCommands; i++) {
/* 2036 */         updateCounts[i] = -3;
/*      */       }
/* 2038 */       SQLException sqlEx = null;
/* 2039 */       for (int commandIndex = 0; commandIndex < nbrCommands; commandIndex++)
/*      */       {
/*      */         try
/*      */         {
/*      */ 
/* 2044 */           updateCounts[commandIndex] = executeUpdate_ex(commandIndex);
/* 2045 */           setPutLobData(2);
/*      */         }
/*      */         catch (SQLException ex)
/*      */         {
/* 2049 */           updateCounts[commandIndex] = -3;
/*      */           
/* 2051 */           if (this.connection.getContinueBatchOnError())
/*      */           {
/* 2053 */             sqlEx = ex;
/*      */           }
/*      */           else
/*      */           {
/* 2057 */             int[] newUpdateCounts = new int[commandIndex];
/* 2058 */             System.arraycopy(updateCounts, 0, newUpdateCounts, 0, commandIndex);
/*      */             
/* 2060 */             throw new BatchUpdateException(ex.getMessage(), ex.getSQLState(), ex.getErrorCode(), 
/* 2061 */               newUpdateCounts);
/*      */           }
/*      */         }
/*      */       }
/*      */       
/* 2066 */       if (sqlEx != null)
/*      */       {
/* 2068 */         throw new BatchUpdateException(sqlEx.getMessage(), sqlEx.getSQLState(), sqlEx.getErrorCode(), 
/* 2069 */           updateCounts);
/*      */       }
/*      */       
/* 2072 */       return updateCounts != null ? updateCounts : new int[0];
/*      */     }
/*      */     finally
/*      */     {
/* 2076 */       setPutLobData(1);
/* 2077 */       clearBatch();
/*      */     }
/*      */   }
/*      */   
/*      */   public int[] executeBatch() throws SQLException
/*      */   {
/* 2083 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2085 */       DmdbLog.trace(this, "executeBatch()", "");
/*      */     }
/*      */     
/* 2088 */     checkClosed();
/*      */     
/* 2090 */     if (this.connection.isReadOnly())
/*      */     {
/* 2092 */       DBError.throwSQLException(6008);
/*      */     }
/* 2094 */     if ((this.dbInfo.getRetStmtType() == 160) || 
/* 2095 */       (this.dbInfo.getRetStmtType() == 198))
/*      */     {
/* 2097 */       throw new BatchUpdateException(this.res.getString("error.invalidSqlType"), null);
/*      */     }
/*      */     
/*      */ 
/* 2101 */     if (this.m_batchItems != null) {
/* 2102 */       return super.executeBatch();
/*      */     }
/* 2104 */     if (!checkBatch()) {
/* 2105 */       return new int[0];
/*      */     }
/*      */     
/* 2108 */     int batchSize = this.m_rowIndex;
/*      */     
/*      */ 
/* 2111 */     if ((this.dbInfo.getRetStmtType() == 162) || (!getIsPutLobData_In()) || (batchSize == 0) || 
/*      */     
/* 2113 */       (batchSize == 1) || 
/* 2114 */       (this.connection.getBatchType() == 2)) {
/* 2115 */       return executeBatchNot();
/*      */     }
/* 2117 */     int[] updateCounts = new int[batchSize];
/* 2118 */     if (batchSize > 1)
/*      */     {
/* 2120 */       this.m_bp_with_err = false;
/*      */       try
/*      */       {
/* 2123 */         updateCounts = DmdbCSI.executePreparedBatch(this);
/*      */       }
/*      */       catch (SQLException ex)
/*      */       {
/* 2127 */         clearBatch();
/* 2128 */         throw new BatchUpdateException(ex.getMessage(), ex.getSQLState(), ex.getErrorCode(), 
/* 2129 */           updateCounts);
/*      */       }
/*      */       
/* 2132 */       if (this.m_bp_with_err)
/*      */       {
/* 2134 */         clearBatch();
/* 2135 */         throw new BatchUpdateException(Const.res.getString("warn.bp_with_err"), updateCounts);
/*      */       }
/*      */     }
/*      */     
/* 2139 */     clearBatch();
/* 2140 */     return updateCounts;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized void setCharacterStream(int parameterIndex, Reader reader, int length)
/*      */     throws SQLException
/*      */   {
/* 2165 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2167 */       if (reader == null) {
/* 2168 */         DmdbLog.trace(this, "setAsciiStream()", "colid = " + parameterIndex + ", reader is null");
/*      */       } else {
/* 2170 */         DmdbLog.trace(this, "setAsciiStream()", 
/* 2171 */           "colid = " + parameterIndex + ", reader is " + reader.toString() + ", length = " + 
/* 2172 */           length);
/*      */       }
/*      */     }
/* 2175 */     paramBindPrepare(parameterIndex);
/*      */     
/* 2177 */     setReaderInner(parameterIndex, reader, length, true);
/*      */   }
/*      */   
/*      */   private void setReaderInner(int parameterIndex, Reader reader, long length, boolean hasLenght)
/*      */     throws SQLException
/*      */   {
/* 2183 */     if ((this.m_curRow[(parameterIndex - 1)] instanceof DmOutParamBinder)) {
/* 2184 */       this.m_curRow[(parameterIndex - 1)].setInoutParamBinder(new DmReaderBinder(this));
/* 2185 */     } else if ((this.m_curRow[(parameterIndex - 1)] instanceof DmNullBinder)) {
/* 2186 */       this.m_curRow[(parameterIndex - 1)] = new DmReaderBinder(this);
/* 2187 */     } else if (!(this.m_curRow[(parameterIndex - 1)] instanceof DmReaderBinder)) {
/* 2188 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2190 */     if (reader == null)
/*      */     {
/* 2192 */       setNullInner(parameterIndex);
/* 2193 */       return;
/*      */     }
/*      */     
/* 2196 */     if (this.m_paramObjects[(parameterIndex - 1)] == null) {
/* 2197 */       this.m_paramObjects[(parameterIndex - 1)] = new DmReaderParam[this.m_rowsAllocated];
/*      */     }
/* 2199 */     if (hasLenght) {
/* 2200 */       ((DmReaderParam[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = new DmReaderParam(reader, 
/* 2201 */         length);
/*      */     } else {
/* 2203 */       ((DmReaderParam[])this.m_paramObjects[(parameterIndex - 1)])[this.m_rowIndex] = new DmReaderParam(reader);
/*      */     }
/*      */   }
/*      */   
/*      */   public synchronized void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
/*      */   {
/* 2209 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2211 */       if (reader == null) {
/* 2212 */         DmdbLog.trace(this, "setAsciiStream()", "colid = " + parameterIndex + ", reader is null");
/*      */       } else {
/* 2214 */         DmdbLog.trace(this, "setAsciiStream()", 
/* 2215 */           "colid = " + parameterIndex + ", reader is " + reader.toString() + ", length = " + 
/* 2216 */           length);
/*      */       }
/*      */     }
/* 2219 */     paramBindPrepare(parameterIndex);
/*      */     
/* 2221 */     setReaderInner(parameterIndex, reader, length, true);
/*      */   }
/*      */   
/*      */   public synchronized void setCharacterStream(int parameterIndex, Reader reader)
/*      */     throws SQLException
/*      */   {
/* 2227 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2229 */       if (reader == null) {
/* 2230 */         DmdbLog.trace(this, "setAsciiStream()", "colid = " + parameterIndex + ", reader is null");
/*      */       } else {
/* 2232 */         DmdbLog.trace(this, "setAsciiStream()", 
/* 2233 */           "colid = " + parameterIndex + ", reader is " + reader.toString());
/*      */       }
/*      */     }
/* 2236 */     paramBindPrepare(parameterIndex);
/*      */     
/* 2238 */     setReaderInner(parameterIndex, reader, 0L, false);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setRef(int i, Ref x)
/*      */     throws SQLException
/*      */   {
/* 2253 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2255 */       if (x == null) {
/* 2256 */         DmdbLog.trace(this, "setRef()", "colid = " + i + ", ref is null");
/*      */       } else {
/* 2258 */         DmdbLog.trace(this, "setRef()", "colid = " + i + ", ref is " + x);
/*      */       }
/*      */     }
/* 2261 */     paramBindPrepare(i);
/*      */     
/* 2263 */     if (x == null) {
/* 2264 */       setNull(i, 2006);
/*      */     } else {
/* 2266 */       throw new SQLException(Const.res.getString("error.unsupportedInterfase"));
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setBlob(int i, Blob x)
/*      */     throws SQLException
/*      */   {
/* 2282 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2284 */       if (x == null) {
/* 2285 */         DmdbLog.trace(this, "setBlob()", "colid = " + i + ", Blob is null");
/*      */       } else {
/* 2287 */         DmdbLog.trace(this, "setBlob()", "colid = " + i + ", Blob is " + x.toString());
/*      */       }
/*      */     }
/* 2290 */     paramBindPrepare(i);
/*      */     
/* 2292 */     setBlobInner(i, x);
/*      */   }
/*      */   
/*      */   private void setBlobInner(int i, Blob x) throws SQLException
/*      */   {
/* 2297 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2298 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmBlobBinder(this));
/* 2299 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2300 */       this.m_curRow[(i - 1)] = new DmBlobBinder(this);
/* 2301 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmBlobBinder)) {
/* 2302 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2304 */     if (x == null)
/*      */     {
/* 2306 */       setNullInner(i);
/* 2307 */       return;
/*      */     }
/*      */     
/* 2310 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2311 */       this.m_paramObjects[(i - 1)] = new Blob[this.m_rowsAllocated];
/*      */     }
/* 2313 */     ((Blob[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setClob(int i, Clob x)
/*      */     throws SQLException
/*      */   {
/* 2329 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2331 */       if (x == null) {
/* 2332 */         DmdbLog.trace(this, "setClob()", "colid = " + i + ", clob is null");
/*      */       } else {
/* 2334 */         DmdbLog.trace(this, "setClob()", "colid = " + i + ", clob is " + x.toString());
/*      */       }
/*      */     }
/* 2337 */     paramBindPrepare(i);
/*      */     
/* 2339 */     setClobInner(i, x);
/*      */   }
/*      */   
/*      */   private void setClobInner(int i, Clob x) throws SQLException
/*      */   {
/* 2344 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2345 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmClobBinder(this));
/* 2346 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2347 */       this.m_curRow[(i - 1)] = new DmClobBinder(this);
/* 2348 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmClobBinder)) {
/* 2349 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2351 */     if (x == null)
/*      */     {
/* 2353 */       setNullInner(i);
/* 2354 */       return;
/*      */     }
/*      */     
/* 2357 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2358 */       this.m_paramObjects[(i - 1)] = new Clob[this.m_rowsAllocated];
/*      */     }
/* 2360 */     ((Clob[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = x;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setArray(int i, Array x)
/*      */     throws SQLException
/*      */   {
/* 2376 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2378 */       if (x == null) {
/* 2379 */         DmdbLog.trace(this, "setArray()", "colid = " + i + ", Array is null");
/*      */       } else
/* 2381 */         DmdbLog.trace(this, "setArray()", "colid = " + i + ", Array is " + x.toString());
/*      */     }
/* 2383 */     paramBindPrepare(i);
/*      */     
/* 2385 */     setArrayInner(i, x);
/*      */   }
/*      */   
/*      */   private void setArrayInner(int i, Array x) throws SQLException
/*      */   {
/* 2390 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2391 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmARRAYBinder(this));
/* 2392 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2393 */       this.m_curRow[(i - 1)] = new DmARRAYBinder(this);
/* 2394 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmARRAYBinder)) {
/* 2395 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2397 */     if (x == null)
/*      */     {
/* 2399 */       setNullInner(i);
/* 2400 */       return;
/*      */     }
/*      */     
/* 2403 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2404 */       this.m_paramObjects[(i - 1)] = new ARRAY[this.m_rowsAllocated];
/*      */     }
/* 2406 */     ((ARRAY[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = ((ARRAY)x);
/*      */   }
/*      */   
/*      */   private void setStructInner(int i, Struct x) throws SQLException
/*      */   {
/* 2411 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2412 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmSTRUCTBinder(this));
/* 2413 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2414 */       this.m_curRow[(i - 1)] = new DmSTRUCTBinder(this);
/* 2415 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmSTRUCTBinder)) {
/* 2416 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2418 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2419 */       this.m_paramObjects[(i - 1)] = new STRUCT[this.m_rowsAllocated];
/*      */     }
/* 2421 */     ((STRUCT[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = ((STRUCT)x);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized ResultSetMetaData getMetaData()
/*      */     throws SQLException
/*      */   {
/* 2449 */     checkClosed();
/* 2450 */     if ((this.dbInfo != null) && (this.dbInfo.getHasResultSet()))
/*      */     {
/* 2452 */       return new DmdbResultSetMetaData_bs(this, this.dbInfo.getColumnsInfo(), this.resultSetConcurrency, 
/* 2453 */         this.connection.getComOra(), this.connection.getClobAsString());
/*      */     }
/* 2455 */     return null;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setDate(int parameterIndex, java.sql.Date x, Calendar cal)
/*      */     throws SQLException
/*      */   {
/* 2479 */     if (x == null)
/*      */     {
/* 2481 */       setNull(parameterIndex, 0);
/* 2482 */       return;
/*      */     }
/*      */     
/* 2485 */     if (cal == null)
/*      */     {
/* 2487 */       cal = Calendar.getInstance();
/*      */     }
/*      */     
/* 2490 */     cal.clear();
/* 2491 */     cal.setTimeInMillis(x.getTime());
/*      */     
/* 2493 */     setDate(parameterIndex, new java.sql.Date(cal.getTimeInMillis()));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setTime(int parameterIndex, Time x, Calendar cal)
/*      */     throws SQLException
/*      */   {
/* 2516 */     if (x == null)
/*      */     {
/* 2518 */       setNull(parameterIndex, 0);
/* 2519 */       return;
/*      */     }
/* 2521 */     if (cal == null)
/*      */     {
/* 2523 */       cal = Calendar.getInstance();
/*      */     }
/* 2525 */     cal.clear();
/* 2526 */     cal.setTimeInMillis(x.getTime());
/*      */     
/* 2528 */     setTime(parameterIndex, new Time(cal.getTimeInMillis()));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
/*      */     throws SQLException
/*      */   {
/* 2552 */     if (x == null)
/*      */     {
/* 2554 */       setNull(parameterIndex, 0);
/* 2555 */       return;
/*      */     }
/* 2557 */     if (cal == null)
/*      */     {
/* 2559 */       cal = Calendar.getInstance();
/*      */     }
/* 2561 */     cal.clear();
/* 2562 */     cal.setTime(x);
/*      */     
/* 2564 */     Timestamp xn = new Timestamp(cal.getTimeInMillis());
/* 2565 */     int nanos = x.getNanos();
/* 2566 */     if (nanos != 0) {
/* 2567 */       xn.setNanos(nanos);
/*      */     }
/* 2569 */     setTimestamp(parameterIndex, xn);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setNull(int paramIndex, int sqlType, String typeName)
/*      */     throws SQLException
/*      */   {
/* 2597 */     setNull(paramIndex, sqlType);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setURL(int parameterIndex, URL x)
/*      */     throws SQLException
/*      */   {
/* 2614 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2616 */       if (x == null) {
/* 2617 */         DmdbLog.trace(this, "setURL()", "colid = " + parameterIndex + ", url is null");
/*      */       } else
/* 2619 */         DmdbLog.trace(this, "setURL()", "colid = " + parameterIndex + ", url is " + x);
/*      */     }
/* 2621 */     paramBindPrepare(parameterIndex);
/*      */     
/* 2623 */     if (x == null) {
/* 2624 */       setNull(parameterIndex, 2000);
/*      */     } else {
/* 2626 */       throw new SQLException(Const.res.getString("error.unsupportedInterfase"));
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public synchronized ParameterMetaData getParameterMetaData()
/*      */     throws SQLException
/*      */   {
/* 2642 */     checkClosed();
/*      */     
/* 2644 */     return new DmdbParameterMetaData_bs(this, this.connection.getComOra());
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setINTERVALYM(int i, DmdbIntervalYM ym)
/*      */     throws SQLException
/*      */   {
/* 2659 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2661 */       if (ym == null) {
/* 2662 */         DmdbLog.trace(this, "setINTERVALYM()", "colid = " + i + ", intervalYM is null");
/*      */       } else {
/* 2664 */         DmdbLog.trace(this, "setINTERVALYM()", "colid = " + i + ", intervalYM is " + ym.toString());
/*      */       }
/*      */     }
/* 2667 */     paramBindPrepare(i);
/*      */     
/* 2669 */     setINTERVALYMInner(i, ym);
/*      */   }
/*      */   
/*      */   private void setINTERVALYMInner(int i, DmdbIntervalYM ym) throws SQLException
/*      */   {
/* 2674 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2675 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmIntvYMBinder(this));
/* 2676 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2677 */       this.m_curRow[(i - 1)] = new DmIntvYMBinder(this);
/* 2678 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmIntvYMBinder)) {
/* 2679 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2681 */     if (ym == null)
/*      */     {
/* 2683 */       setNullInner(i);
/* 2684 */       return;
/*      */     }
/*      */     
/* 2687 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2688 */       this.m_paramObjects[(i - 1)] = new DmdbIntervalYM[this.m_rowsAllocated];
/*      */     }
/* 2690 */     ((DmdbIntervalYM[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = ym;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setINTERVALDT(int i, DmdbIntervalDT dt)
/*      */     throws SQLException
/*      */   {
/* 2701 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2703 */       if (dt == null) {
/* 2704 */         DmdbLog.trace(this, "setINTERVALDT()", "colid = " + i + ", intervalDT is null");
/*      */       } else {
/* 2706 */         DmdbLog.trace(this, "setINTERVALDT()", "colid = " + i + ", intervalDT is " + dt.toString());
/*      */       }
/*      */     }
/* 2709 */     paramBindPrepare(i);
/*      */     
/* 2711 */     setINTERVALDTInner(i, dt);
/*      */   }
/*      */   
/*      */   private void setINTERVALDTInner(int i, DmdbIntervalDT dt) throws SQLException
/*      */   {
/* 2716 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2717 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmIntvDTBinder(this));
/* 2718 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2719 */       this.m_curRow[(i - 1)] = new DmIntvDTBinder(this);
/* 2720 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmIntvDTBinder)) {
/* 2721 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2723 */     if (dt == null)
/*      */     {
/* 2725 */       setNullInner(i);
/* 2726 */       return;
/*      */     }
/*      */     
/* 2729 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2730 */       this.m_paramObjects[(i - 1)] = new DmdbIntervalDT[this.m_rowsAllocated];
/*      */     }
/* 2732 */     ((DmdbIntervalDT[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = dt;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setTIME(int i, DmdbTime t)
/*      */     throws SQLException
/*      */   {
/* 2743 */     if (Const.TRACE_LEVEL > 0)
/*      */     {
/* 2745 */       if (t == null) {
/* 2746 */         DmdbLog.trace(this, "setTIME()", "colid = " + i + ", time is null");
/*      */       } else {
/* 2748 */         DmdbLog.trace(this, "setTIME()", "colid = " + i + ", time is " + t);
/*      */       }
/*      */     }
/* 2751 */     paramBindPrepare(i);
/*      */     
/* 2753 */     setTIMEInner(i, t);
/*      */   }
/*      */   
/*      */   private void setTIMEInner(int i, DmdbTime t) throws SQLException
/*      */   {
/* 2758 */     if ((this.m_curRow[(i - 1)] instanceof DmOutParamBinder)) {
/* 2759 */       this.m_curRow[(i - 1)].setInoutParamBinder(new DmdmTimeBinder(this));
/* 2760 */     } else if ((this.m_curRow[(i - 1)] instanceof DmNullBinder)) {
/* 2761 */       this.m_curRow[(i - 1)] = new DmdmTimeBinder(this);
/* 2762 */     } else if (!(this.m_curRow[(i - 1)] instanceof DmdmTimeBinder)) {
/* 2763 */       throw new SQLException("Different object bound with the first row in the same column");
/*      */     }
/* 2765 */     if (t == null)
/*      */     {
/* 2767 */       setNullInner(i);
/* 2768 */       return;
/*      */     }
/*      */     
/* 2771 */     if (this.m_paramObjects[(i - 1)] == null) {
/* 2772 */       this.m_paramObjects[(i - 1)] = new DmdbTime[this.m_rowsAllocated];
/*      */     }
/* 2774 */     ((DmdbTime[])this.m_paramObjects[(i - 1)])[this.m_rowIndex] = t;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   protected DmdbInfo preparedExceute(int irow)
/*      */     throws SQLException
/*      */   {
/* 2790 */     clearOutParamVal();
/*      */     
/* 2792 */     this.dbInfo = DmdbCSI.executePrepared(this, irow);
/*      */     
/* 2794 */     return this.dbInfo;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   protected synchronized int executeUpdate_ex(int irow)
/*      */     throws SQLException
/*      */   {
/* 2815 */     executeInner(irow, 3);
/*      */     
/* 2817 */     if ((this instanceof DmdbCallableStatement_bs))
/*      */     {
/* 2819 */       ((DmdbCallableStatement_bs)this).colsInfo = new ArrayList(
/* 2820 */         ((DmdbCallableStatement_bs)this).resultsCount);
/* 2821 */       ((DmdbCallableStatement_bs)this).colsInfo.add(this.dbInfo.getColumnsInfo());
/* 2822 */       this.rsCache = null;
/*      */     }
/* 2824 */     if (this.dbInfo.getRowCount() > 2147483647L)
/*      */     {
/* 2826 */       return Integer.MAX_VALUE;
/*      */     }
/*      */     
/*      */ 
/* 2830 */     return (int)this.dbInfo.getRowCount();
/*      */   }
/*      */   
/*      */   private void executeInner(int irow, int typeExec)
/*      */     throws SQLException
/*      */   {
/*      */     try
/*      */     {
/* 2838 */       checkClosed();
/*      */       
/*      */ 
/* 2841 */       if (!this.m_isBatchOpt) {
/* 2842 */         checkParamBoundInner();
/*      */       }
/* 2844 */       this.resId = 0;
/*      */       
/* 2846 */       boolean getCachedRs = false;
/* 2847 */       boolean innerQuery = false;
/* 2848 */       switch (typeExec)
/*      */       {
/*      */       case 2: 
/* 2851 */         if (!this.dbInfo.isRetStmtTypeQuery())
/* 2852 */           DBError.throwSQLException(6009);
/* 2853 */         getCachedRs = true;
/* 2854 */         break;
/*      */       
/*      */       case 3: 
/* 2857 */         if (this.connection.isReadOnly()) {
/* 2858 */           DBError.throwSQLException(6008);
/*      */         }
/* 2860 */         if (this.dbInfo.isRetStmtTypeUpd())
/* 2861 */           DBError.throwSQLException(6009);
/* 2862 */         break;
/*      */       
/*      */       case 1: 
/* 2865 */         getCachedRs = true;
/* 2866 */         break;
/*      */       
/*      */       case 4: 
/* 2869 */         innerQuery = true;
/* 2870 */         break;
/*      */       
/*      */       default: 
/* 2873 */         DBError.throwSQLException(20005);
/*      */       }
/*      */       
/* 2876 */       if (getCachedRs)
/*      */       {
/* 2878 */         DmdbConnection_bs.execSqlNum += 1;
/* 2879 */         if (enableRsCache()) {
/* 2880 */           this.currentRs = DmdbCachedResultSetPool.getResultSet(this.connection.getGUID(), 
/* 2881 */             this.connection.getSchema(), this.originalSql, this);
/*      */         } else {
/* 2883 */           this.currentRs = null;
/*      */         }
/* 2885 */         if (this.currentRs != null)
/*      */         {
/* 2887 */           DmdbConnection_bs.rsCachedNum += 1;
/* 2888 */           this.dbInfo = this.currentRs.dbInfo;
/* 2889 */           return;
/*      */         }
/*      */       }
/*      */       
/* 2893 */       this.dbInfo = preparedExceute(irow);
/*      */       
/* 2895 */       setPrintMsg(this.dbInfo.getPrintMsg());
/*      */       
/* 2897 */       if ((this instanceof DmdbCallableStatement_bs)) {
/* 2898 */         ((DmdbCallableStatement_bs)this).m_paramsDesc = this.dbInfo.getParamsInfo();
/*      */       }
/* 2900 */       if (this.dbInfo.getHasResultSet()) {
/* 2901 */         this.resId = ((short)(this.resId + 1));
/*      */       }
/* 2903 */       if (innerQuery) {
/* 2904 */         this.currentRs = getResultSet(true);
/*      */       } else {
/* 2906 */         this.currentRs = getResultSetPrivate(1);
/*      */       }
/*      */     }
/*      */     catch (SQLException sqlEx)
/*      */     {
/* 2911 */       this.realClose = true;
/*      */       
/* 2913 */       throw sqlEx;
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public String getPrintMsg()
/*      */     throws SQLException
/*      */   {
/* 2925 */     return this.printMsg;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   protected void setPrintMsg(String msg)
/*      */   {
/* 2935 */     if (this.printMsg == null)
/*      */     {
/* 2937 */       this.printMsg = msg;
/*      */     }
/*      */     else
/*      */     {
/* 2941 */       this.printMsg = (this.printMsg + "\t" + msg);
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public int getSqlType()
/*      */     throws SQLException
/*      */   {
/* 2955 */     int retType = this.dbInfo.getRetStmtType();
/*      */     int sqlType;
/* 2957 */     int sqlType; int sqlType; int sqlType; switch (retType)
/*      */     {
/*      */     case 162: 
/*      */     case 178: 
/* 2961 */       sqlType = 3;
/* 2962 */       break;
/*      */     case 160: 
/* 2964 */       sqlType = 1;
/* 2965 */       break;
/*      */     case 152: 
/* 2967 */       sqlType = 4;
/* 2968 */       break;
/*      */     default: 
/* 2970 */       sqlType = 2;
/*      */     }
/*      */     
/* 2973 */     return sqlType;
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public void setParamValue(int colIndex, DmdbParamVal paraVal)
/*      */     throws SQLException
/*      */   {
/* 2983 */     checkIndexInner(colIndex);
/*      */     
/* 2985 */     int jtype = paraVal.getObjType();
/* 2986 */     Object obj = paraVal.getObjVal();
/* 2987 */     if (obj == null)
/*      */     {
/* 2989 */       setNull(colIndex, 0);
/* 2990 */       return;
/*      */     }
/*      */     
/* 2993 */     switch (jtype)
/*      */     {
/*      */     case 25: 
/* 2996 */       if ((paraVal.hasTargetScale()) && ((obj instanceof BigDecimal))) {
/* 2997 */         setObject(colIndex, paraVal.getObjVal(), 3, paraVal.getTargetScale());
/*      */       } else
/* 2999 */         setObject(colIndex, obj);
/* 3000 */       break;
/*      */     
/*      */     case 18: 
/* 3003 */       if (paraVal.hasLength()) {
/* 3004 */         setCharacterStream(colIndex, (Reader)obj, paraVal.getLength());
/*      */       } else
/* 3006 */         setCharacterStream(colIndex, (Reader)obj);
/* 3007 */       break;
/*      */     
/*      */     case 19: 
/* 3010 */       if (paraVal.hasLength()) {
/* 3011 */         setAsciiStream(colIndex, (InputStream)obj, paraVal.getLength());
/*      */       } else
/* 3013 */         setAsciiStream(colIndex, (InputStream)obj);
/* 3014 */       break;
/*      */     
/*      */     default: 
/* 3017 */       setObject(colIndex, obj);
/*      */     }
/*      */     
/*      */   }
/*      */   
/*      */ 
/*      */   public ParameterDesc[] getParamsDesc()
/*      */   {
/* 3025 */     return this.m_paramsDesc;
/*      */   }
/*      */   
/*      */   public void clearBatch() throws SQLException
/*      */   {
/* 3030 */     super.clearBatch();
/* 3031 */     clearParameters();
/*      */   }
/*      */   
/*      */   public void setBpWithErr(boolean b)
/*      */   {
/* 3036 */     this.m_bp_with_err = b;
/*      */   }
/*      */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\driver\DmdbPreparedStatement_bs.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */